package com.ruoyi.business.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.ruoyi.bizsys.service.ICustBindCardLogService;
import com.ruoyi.business.service.IBankCardService;
import com.ruoyi.business.service.IPayTransService;
import com.ruoyi.business.service.ITransferService;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: jamnsin
 * @Date: 2022/8/26 16:06
 */
@Service
public class TransferServiceImpl implements ITransferService {

    @Autowired
    ICustBindCardLogService custBindCardLogService;

    @Autowired
    IBankCardService bankCardService;

    @Autowired
    IPayTransService payTransService;

    public static final String TRANSFER_FLAG_BIND_CARD = "bind_card";
    public static final String TRANSFER_FLAG_CARD_PAY = "card_pay";

    @Override
    public JSONObject verifyTransaction(String reference, String transferFlag) {

        String apiName = "Verify-Transaction";
        if (StringUtils.equals(transferFlag, TRANSFER_FLAG_BIND_CARD)) {
            apiName = "Verify-Transaction-Bind";
        }

        return payTransService.verifyTransaction(reference, apiName);
    }
}
